﻿Public Class EstadoRecetaDAO
    Public Shared CORRECTA = 1
    Public Shared PENDIENTE_CORRECCION = 2
    Public Shared CORREGIDA = 3
    Public Shared DEVUELTA_A_LA_FARMACIA = 4
    Public Shared EXCLUIDA = 5
    Public Shared Function obtenerEstadosRecetas(ByVal EstadoRecetaId As Integer) As DataTable
        Dim cn As SqlClient.SqlConnection = Nothing
        Try
            cn = Conexion.Conectar
            Dim ds As New DataSet
            Dim da As New SqlClient.SqlDataAdapter("usp_estadoReceta_obtener", cn)
            da.SelectCommand.CommandType = CommandType.StoredProcedure
            da.SelectCommand.Parameters.AddWithValue("@EstadoRecetaId", EstadoRecetaId).DbType = DbType.Int32
            da.Fill(ds, "EstadoReceta")

            Return ds.Tables("EstadoReceta")
        Catch ex As Exception
            'GUARDAMOS EL ERROR EN LA BD
            ErrorDAO.insertarError(ex)
            Return Nothing
        Finally
            Conexion.Desconectar(cn) 'PASAR POR PARAMETRO LA CONEXION
        End Try
    End Function
End Class
